public class Test {
    public static void main(String[] args) {
        //需求：数组元素求和
        //1、把这些数据拿到程序中使用数组记住
        int[] money = {16,32,8,100,78};
        //2、定义一个求和变量累加数组的元素值
        int sum = 0;
        //3、遍历数组的中的每个元素
        for (int i = 0; i < money.length; i++) {
            sum += money[i];

        }
        //4、输出求和变量求和即可
        System.out.println("数组元素和是"+sum);




        int[] ages ={1,2,3,4,56,7,8,9,};
        int sum1 = 0;
        for (int i = 0; i < ages.length; i++) {
            sum1 += ages[i];

        }
        System.out.println("数组元素和是"+sum1);
    }
}
